package com.tiny.tests;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;

import com.tiny.core.game.Game;
import com.tiny.core.input.KeyboardManager;

public class GameConfigTest extends Game {

    @Override
    public void onLoad() {
        
    }

    @Override
    public void onUnload() {

    }

    @Override
    public void onUpdate(int currentTick) {
        if (KeyboardManager.getInstance().isPressed(KeyEvent.VK_1)) {
            getGameConfig().setScreenWidth(800);
            getGameConfig().setScreenHeight(600);
            updateGameConfig();
        }

        if (KeyboardManager.getInstance().isPressed(KeyEvent.VK_2)) {
            getGameConfig().setScreenWidth(1024);
            getGameConfig().setScreenHeight(768);
            updateGameConfig();
        }

        if (KeyboardManager.getInstance().isPressed(KeyEvent.VK_3)) {
            getGameConfig().setScreenWidth(1280);
            getGameConfig().setScreenHeight(1024);
            updateGameConfig();
        }

        if (KeyboardManager.getInstance().isPressed(KeyEvent.VK_ESCAPE)) {
            terminate();
        }
    }

    @Override
    public void onRender(Graphics2D g) {
        g.setColor(Color.WHITE);
        g.drawString("1 = 800  x 600", 10, 10);
        g.drawString("2 = 1024 x 768", 10, 30);
        g.drawString("3 = 1280 x 1024", 10, 50);
    }

    @Override
    public String getTitle() {
        return "Game Config Test";
    }

    public static void main(String[] args) {
        new GameConfigTest().run();
    }
}
